import { createRouter, createWebHashHistory } from 'vue-router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Home from '../views/Home.vue'

// 路由配置
const routes = [
  {
    path: "/", 
    redirect: "/login" 
  },
  {
    name: "Login",
    path: '/login',
    component: Login
  },
  {
    name: "Register",
    path: '/register',
    component: Register
  },
  {
    name: "Home",
    path: '/home',
    component: Home,
    children: [
      {
        name: "Chat",
        path: "/home/chat",
        component: () => import("../views/Chat.vue"),
      },
      {
        name: "Friend",
        path: "/home/friend",
        component: () => import("../views/Friend.vue"),
      },
      {
        name: "GROUP",
        path: "/home/group",
        component: () => import("../views/Group.vue"),
      },
      {
        name: "ChatBox",
        path: "/home/chatbox/:data",
        component: () => import("../views/test.vue"),
      },
      {
        path: '/home/moments',
        name: 'moments',
        component: () => import('../views/Moments.vue')
      },
      // cross 目录下的页面
      {
        path: '/home/cross/python',
        name: 'CrossPython',
        component: () => import('../views/cross/python/Index.vue')
      },
      {
        path: '/home/cross/java',
        name: 'CrossJava',
        component: () => import('../views/cross/java/Index.vue')
      },
      {
        path: '/home/cross/go',
        name: 'CrossGo',
        component: () => import('../views/cross/go/Index.vue')
      },
      // effect 目录下的页面
      {
        path: '/home/effect/login',
        name: 'EffectLogin',
        component: () => import('../views/effect/login/Index.vue')
      },
      {
        path: '/home/effect/login/window',
        name: 'EffectLoginWindow',
        component: () => import('../views/effect/login/Window.vue')
      },
      // framework 目录下的页面
      {
        path: '/home/framework/updater',
        name: 'FrameworkUpdater',
        component: () => import('../views/framework/updater/Index.vue')
      },
      {
        path: '/home/framework/sqlitedb',
        name: 'FrameworkSqliteDB',
        component: () => import('../views/framework/sqlitedb/Index.vue')
      },
      {
        path: '/home/framework/software',
        name: 'FrameworkSoftware',
        component: () => import('../views/framework/software/Index.vue')
      },
      {
        path: '/home/framework/jobs',
        name: 'FrameworkJobs',
        component: () => import('../views/framework/jobs/Index.vue')
      },
      {
        path: '/home/framework/socket/http-server',
        name: 'FrameworkHttpServer',
        component: () => import('../views/framework/socket/HttpServer.vue')
      },
      {
        path: '/home/framework/socket/socket-server',
        name: 'FrameworkSocketServer',
        component: () => import('../views/framework/socket/SocketServer.vue')
      },
      {
        path: '/home/framework/socket/ipc',
        name: 'FrameworkIpc',
        component: () => import('../views/framework/socket/Ipc.vue')
      },
      // os 目录下的页面
      {
        path: '/home/os/window',
        name: 'OsWindow',
        component: () => import('../views/os/window/Index.vue')
      },
      {
        path: '/home/os/subwindow/ipc',
        name: 'OsSubwindowIpc',
        component: () => import('../views/os/subwindow/Ipc.vue')
      },
      {
        path: '/home/os/notification',
        name: 'OsNotification',
        component: () => import('../views/os/notification/Index.vue')
      },
      {
        path: '/home/os/file',
        name: 'OsFile',
        component: () => import('../views/os/file/Index.vue')
      },
      {
        path: '/home/os/file/pic',
        name: 'OsFilePic',
        component: () => import('../views/os/file/Pic.vue')
      }
    ]
  },
];

// 创建路由实例
const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
